cc.Class({
    extends: cc.Component,

    properties: {
        nd_toast: cc.Node,
        lb_label: cc.Label,
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad() {
        this.bAniming = false;
        G.insToast = this;
        this.nd_toast.opacity = 0;
    },

    // start () {
    //
    // },

    // update (dt) {},

    showToast(msg) {
        if (this.bAniming) {
            return;
        }

        this.bAniming = true;
        this.lb_label.string = msg;
        this.nd_toast.y = -240;
        this.nd_toast.scale = 0.1;
        this.nd_toast.opacity = 255;

        cc.tween(this.nd_toast).to(0.1, {scale: 1}).by(0.5, {
            y: 100,
        }).delay(1).call(() => {
            this.nd_toast.opacity = 0;
            this.bAniming = false;
        }).start();
    },
});
